package com.example.admin.common.util;

import org.springframework.util.DigestUtils;

public class PasswordEncoder {
    private static final String SALT = "MTAB_ADMIN";

    public static String encode(String password) {
        // 加盐后进行md5加密
        return DigestUtils.md5DigestAsHex((password + SALT).getBytes());
    }

    public static boolean matches(String rawPassword, String encodedPassword) {
        return encode(rawPassword).equals(encodedPassword);
    }
} 